#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
LD_PRELOAD 进程隐藏权限维持模块
"""

from .core import LDPreloadPersistenceModule
from ..base import PersistenceConfig, PersistenceResult, PersistenceStatus, PersistenceLevel

# 模块信息
__version__ = "1.0.0"
__author__ = "privilege-maDev Team"
__description__ = "LD_PRELOAD 进程隐藏权限维持模块"

def create_module():
    """创建 LD_PRELOAD 权限维持模块实例"""
    return LDPreloadPersistenceModule()

def get_module_info():
    """获取模块信息"""
    return {
        'name': 'ld_preload',
        'version': __version__,
        'author': __author__,
        'description': __description__,
        'supported_platforms': ['linux'],
        'persistence_types': ['ld_preload'],
        'stealth_levels': list(range(1, 11)),
        'requires_root': True,
        'requires_compilation': True,
        'dependencies': ['gcc', 'libc6-dev']
    }

def is_available():
    """检查模块是否可用"""
    import os
    import shutil
    
    # 检查是否为 Linux 系统
    if os.name != 'posix':
        return False
    
    # 检查是否有编译环境
    if not shutil.which('gcc'):
        return False
    
    # 检查是否有 root 权限
    if os.geteuid() != 0:
        return False
    
    return True

__all__ = ['LDPreloadPersistenceModule', 'create_module', 'get_module_info', 'is_available']